//
//  AppDelegate.m
//  demo-圈子
//
//  Created by Mac on 15/8/10.
//  Copyright (c) 2015年 Itcast. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#import "DSGuideViewController.h"
#import "DSHomeViewController.h"
#import "DSTabBarViewController.h"
#import "DSToolsViewController.h"
#import "DSNewsViewController.h"
#import "DSCirleViewController.h"
#import "DSShakeViewController.h"
#import "DSAboutViewController.h"
#import "DSOnlineViewController.h"
#import "DSXMPPViewController.h"


@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

    [self.window makeKeyAndVisible];
    
    
    
    ViewController *view  = [[ViewController alloc]init];
    //这个是UIStoryboard获取视图的方法
    UIStoryboard *strory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    //DSHomeViewController *home = [strory instantiateViewControllerWithIdentifier:@"DSHomeViewController"];
    
    view.view.backgroundColor = [UIColor yellowColor];
    
    //改变根视图控制器 为 TabBarContoller
    
    _tab  = [[DSTabBarViewController alloc]init];
    
    //home页面
    DSHomeViewController *home = [strory instantiateViewControllerWithIdentifier:@"DSHomeViewController"];
    
    UINavigationController *homeNav = [[UINavigationController alloc]initWithRootViewController:home];
    homeNav.navigationBarHidden = YES;
    
    //新闻视图
    DSNewsViewController *news = [strory instantiateViewControllerWithIdentifier:@"DSNewsViewController"];
    
    UINavigationController *newsNav = [[UINavigationController alloc]initWithRootViewController:news];
    
    //圈子视图
    DSCirleViewController *circle = [strory instantiateViewControllerWithIdentifier:@"DSCirleViewController"];
    
    UINavigationController *circleNav = [[UINavigationController alloc]initWithRootViewController:circle];
    
    DSToolsViewController *tools = [strory instantiateViewControllerWithIdentifier:@"DSToolsViewController"];
    
    UINavigationController *toolNav = [[UINavigationController alloc]initWithRootViewController:tools];
    
    //摇一摇页面
    DSShakeViewController *shake = [strory instantiateViewControllerWithIdentifier:@"DSShakeViewController"];
    
    UINavigationController *shakeNav = [[UINavigationController alloc]initWithRootViewController:shake];
    
    //联系商家
    DSXMPPViewController *xmpp = [strory instantiateViewControllerWithIdentifier:@"DSXMPPViewController"];
    
    UINavigationController *xmppNav = [[UINavigationController alloc]initWithRootViewController:xmpp];
    
    //直播
    DSOnlineViewController *online = [strory instantiateViewControllerWithIdentifier:@"DSOnlineViewController"];
    
    UINavigationController *onineNav = [[UINavigationController alloc]initWithRootViewController:online];
    
    //关于我们
    DSAboutViewController *about = [strory instantiateViewControllerWithIdentifier:@"DSAboutViewController"];
    
    UINavigationController *aboutNav = [[UINavigationController alloc]initWithRootViewController:about];
    
    
    _tab.viewControllers = @[homeNav,newsNav,circleNav,toolNav,shakeNav,xmppNav,onineNav,aboutNav];
    
    
    self.window.rootViewController = _tab;
    //[[DSGuideViewController alloc]init];
    return YES;
}


@end
